package com.ruoyi.sale.service.impl;

import com.ruoyi.sale.domain.ApprovalProcess;
import com.ruoyi.sale.mapper.ApprovalProcessMapper;
import com.ruoyi.sale.service.IApprovalProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApprovalProcessServiceImpl implements IApprovalProcessService {

    @Autowired
    private ApprovalProcessMapper approvalProcessMapper;

    @Override
    public int insertApprovalProcess(ApprovalProcess approvalProcess) {
        return approvalProcessMapper.insertApprovalProcess(approvalProcess);
    }

    @Override
    public int updateApprovalProcess(ApprovalProcess approvalProcess,Boolean flag) {
        if (flag == true) {
            approvalProcess.setStatus("1");
        }else{
            approvalProcess.setStatus("2");
        }
        return approvalProcessMapper.updateApprovalProcess(approvalProcess);
    }

    @Override
    public List<ApprovalProcess> selectApprovalProcessList(ApprovalProcess approvalProcess) {
        return approvalProcessMapper.selectApprovalProcessList(approvalProcess);
    }

    @Override
    public int updateStatusInt(Long planId) {
        return approvalProcessMapper.updateStatusInt(planId);
    }
}
